package com.xja.book.controller;

import com.xja.book.entity.BookInfo;
import com.xja.book.service.BookInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("book")
public class BookInfoController {
    @Autowired
    private BookInfoService bookInfoService;

    @RequestMapping("booklist")
    public @ResponseBody
    Map<String,Object> BookList(Model model){
        Map<String,Object> mp=new HashMap<String, Object>();
        try {
            mp.put("status","true");
            mp.put("bookInfoList",bookInfoService.findBookInfoAll());
            return mp;
        }catch(Exception ex){
            ex.printStackTrace();
        }
        mp.put("status","false");
        return mp;
    }


}
